package cn.xluobo.business.wechat.miniapp.base.controller;

import cn.xluobo.business.sys.admin.repo.model.SysDictData;
import cn.xluobo.business.sys.admin.service.ISysDictDataService;
import cn.xluobo.core.api.APIResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 字典服务
 * @author ：KingLong
 * @date ：Created in 2020/10/26 15:07
 */
@RestController
@RequestMapping("/api/wechat/miniapp/{appId}/base/dict")
public class WechatMiniDictController {

    @Autowired
    private ISysDictDataService dictTypeDataList;

    /**
     * 字段数据
     * @param dictType
     * @return
     */
    @GetMapping("/data/{dictType}")
    public APIResponse dictData(@PathVariable("dictType") String dictType){
        List<SysDictData> dictDataList = dictTypeDataList.dictTypeDataList(dictType);
        return APIResponse.toAPIResponse(dictDataList);
    }
}
